"""
@file:   manage.py
@author: Shuai
@date:   2020/04/30
"""
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager

from models import db
from app import create_app

app = create_app()
manager = Manager(app)


migrate = Migrate(app, db)
# with app.app_context():
#     migrate = Migrate()
#     if db.engine.url.drivername == 'sqlite':
#         migrate.init_app(app, db, render_as_batch=True)
#     else:
#         migrate.init_app(app, db)

# 添加迁移脚本的命令到manager中
manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    manager.run()
